<!--
 * @Description:
 * @Author: zzp
 * @Date: 2022-02-11 16:49:55
 * @LastEditTime: 2022-03-04 09:35:54
 * @LastEditors: zzp
 * @Reference:
-->
<template>
  <div id="app">
    <router-view />
  </div>
</template>

<script>
import { getMenuList } from "@/api/menuApi.js";
import { showMessage } from "@/utils/msg.js";

export default {
  name: "App",
  created() {
    showMessage();
    this.initState();
    this.getMenuList();
  },
  provide() {
    return {
      reload: this.reload,
    };
  },
  methods: {
    // 初始化State
    initState() {
      this.$store.dispatch("user/initState");
      this.$store.dispatch("worktab/initState");
      this.$store.dispatch("setting/initState");
    },
    // 获取菜单列表
    getMenuList() {
      getMenuList();
    },
    reload() {
      this.isRouterAlive = false;
      this.$nextTick(() => (this.isRouterAlive = true));
    },
  },
};
</script>
